How can I simplify my Python code to compare two lists for three consecutive matching items

join shbcf.ru